<%@page pageEncoding="UTF-8" %>
<!doctype html>
<html lang="zh-cmn">
<head>
    <title>Document</title>
    <%@include file="/WEB-INF/jsp/header.jsp"%>
</head>
<body>
<div class="container-fluid">
    <div class="panel panel-info">
        <div class="panel-heading">
            <span class="h3"><i class="layui-icon"></i>搜索</span>
            <a href=".panel-body" class="caret pull-right" data-toggle="collapse"></a>
        </div>
        <div class="panel-body collapse in fade">
            <form id="con" class="pull-left form-inline">
                <div class="form-group">
                    <div>
                        <label>销毁单号：</label>
                        <input class="form-control" type="text" name="planNum" oninput="search()" placeholder="请输入销毁单号" value="">
                    </div><br/>
                    <div>
                        <label>采&nbsp;购&nbsp;员&nbsp;：</label>
                        <input class="form-control" type="text" name="proName" oninput="search()" placeholder="请输入采购员名称" value="">
                    </div>
                </div>
                <div class="form-group" style="margin-left: 15px;margin-right: 15px;">
                    <div>
                        <label>提交日期：</label>
                        <input class="form-control" type="text" name="subStrartdate" oninput="search()" placeholder="起始提交日期" value="">
                    </div><br/>
                    <div>
                        <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
                        <input class="form-control" type="text" name="subEnddate" oninput="search()" placeholder="结束提交日期" value="">
                    </div>
                </div>
                <div class="form-group" style="margin-right: 40px;">
                    <div>
                        <label>计划销毁日期：</label>
                        <input class="form-control" type="text" name="startDate" oninput="search()" placeholder="起始销毁日期" value="">
                    </div><br/>
                    <div>
                        <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
                        <input class="form-control" type="text" name="endDate" oninput="search()" placeholder="结束销毁日期" value="">
                    </div>
                </div>
                <button type="button" onclick="search()" class="layui-btn layui-btn-small" style="margin-top: 50px;">
                    <i class="layui-icon"></i> 搜索
                </button>
            </form>
        </div>
    <table id="PendingAuditTable"
        data-toggle="table"
        data-url="${ctx}/audit/searchPendingAudit"
        data-toolbar="#toolbar"
        data-striped="true"
        data-pagination="true"
        data-side-pagination="server"
    >
        <thead>
            <tr>
                <th data-field="desNum">销毁单号</th>
                <th data-field="desDate">提交日期</th>
                <th data-field="desUnit">销毁单位</th>
                <th data-field="desSubdate">销毁时间</th>
                <th data-field="worker.woName">采购员</th>
                <th data-field="desAuditstate" data-formatter="optState">审核状态</th>
                <th data-formatter="optEvent" data-events="optEvents">操作</th>
            </tr>
        </thead>
    </table>
</div>
<%@include file="/WEB-INF/jsp/footer.jsp"%>
<script>
    function search() {
        var param={};
        param.planNum=$("input[name='planNum']").val();
        param.proName=$("input[name='proName']").val();
        param.subStrartdate=$("input[name='subStrartdate']").val();
        param.subEnddate=$("input[name='subEnddate']").val();
        param.startDate=$("input[name='startDate']").val();
        param.endDate=$("input[name='endDate']").val();
        $("#PendingAuditTable").bootstrapTable("refresh",{query:param});
    }
    function optState(event) {
        return event==0?"未审核":"未通过";
    }
    function optEvent() {
        return '<button type="button" class="layui-btn layui-btn-mini showDetail" >查看</button>'
    };
    window.optEvents={
        "click .showDetail":function (e,value,row) {
            var desNum = row.desNum;
            console.log(desNum)
            location.href=ctx+"/audit/searchdetails?desNum="+desNum;
        }
    }
    //搜索日期插件
    $(function () {
        laydate.render({
            elem:'[name=startDate]'
        })
        laydate.render({
            elem:'[name=endDate]'
        })
        laydate.render({
            elem:'[name=subStrartdate]'
        })
        laydate.render({
            elem:'[name=subEnddate]'
        })
    });
</script>
</body>
</html>
